// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
    public static void main(String[] args) {

    }
}
class Solution {
    public long minimumSteps(String s) {
        if(s.length()==1) return 0;
        long ans = 0;
        char[] ch = s.toCharArray();
        int one = 0;
        int i=0, j=0;
        while(i<s.length()){
            while(i<s.length() && ch[i]=='0') i++;
            ans += (long)one*(i-j);
            while(i<s.length() && ch[i]=='1'){
                i++;
                one++;
            }
            j = i;
        }
        return ans;
    }
}